package com.totoro.tymapping.executor.slotparse.impl;

import com.totoro.tymapping.constants.OriginSlotConst;
import com.totoro.tymapping.executor.slotparse.SlotParseExecutor;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.List;

/**
 * @author Totoro
 * @version 0.1.0
 * @date 2025/8/13 - 16:03
 * @description
 **/
public class OriginExecutor implements SlotParseExecutor {
    @Override
    public Boolean execute(String slot, List<String> condition, Player player) {
        // 比对原版槽位，获取ItemStack
        condition = getSlotCondition(condition);
        ItemStack itemStack = null;
        switch (slot) {
            case OriginSlotConst.ORIGIN_HEAD:
                itemStack = player.getInventory().getHelmet();
                break;
            case OriginSlotConst.ORIGIN_CHEST:
                itemStack = player.getInventory().getChestplate();
                break;
            case OriginSlotConst.ORIGIN_LEGS:
                itemStack = player.getInventory().getLeggings();
                break;
            case OriginSlotConst.ORIGIN_FEET:
                itemStack = player.getInventory().getBoots();
                break;
            case OriginSlotConst.ORIGIN_MAIN_HAND:
                itemStack = player.getInventory().getItemInMainHand();
                break;
            case OriginSlotConst.ORIGIN_OFF_HAND:
                itemStack = player.getInventory().getItemInOffHand();
                break;
        }
        return doParseValue(condition, itemStack, player);
    }
}
